require("../../../../../@babel/runtime/helpers/Arrayincludes");
var e = require("../../../../../@babel/runtime/helpers/regeneratorRuntime"),
  t = require("../../../../../@babel/runtime/helpers/objectSpread2"),
  r = require("../../../../../@babel/runtime/helpers/slicedToArray"),
  n = require("../../../../../@babel/runtime/helpers/asyncToGenerator"),
  i = require("../../../../../store/index");
Component({
  data: {
    list: [],
    showBack: !0
  },
  properties: {
    content: null
  },
  methods: {
    getRecommend: function () {
      var a = this;
      return n(e().mark((function n() {
        var o, s, u, c, d, l, m, p, h, b, v, g, f, q, x, _;
        return e().wrap((function (e) {
          for (;;) switch (e.prev = e.next) {
            case 0:
              if (s = (0, i.getState)().storage.recommendMode) {
                e.next = 3;
                break
              }
              return e.abrupt("return");
            case 3:
              return u = a.data.content, c = u.prov_id, d = u.city_id, l = u.uuid, m = u.labels, p = (null == m || null === (o = m.location) || void 0 === o ? void 0 : o.value) || "", h = p.split(","), b = r(h, 2), v = b[0], g = b[1], f = {
                uu_id: l,
                mode: s,
                class_ids: a.data.content.class.map((function (e) {
                  return e.id
                })).join(","),
                prov_id: c,
                city_id: d,
                longitude: v || "",
                latitude: g || ""
              }, e.next = 16, $.request["GET/v2/index/recommend"](t(t({}, f), {}, {
                source: "XCX"
              }));
            case 16:
              q = e.sent, x = r(q, 1), 20002 === (_ = x[0]).code && a.setData({
                list: _.data.data
              }),console.log(_);
            case 20:
            case "end":
              return e.stop()
          }
        }), n)
      })))()
    },
    onBackShowMore: function () {
      var e = this.data.content.mode;
      $.router.push("/pages/index/index", {
        mode: e
      })
    }
  },
  lifetimes: {
    attached: function () {
      this.getRecommend();
      var e = getCurrentPages(),
        t = e[e.length - 2],
        r = null == t ? void 0 : t.route;
      r && r.includes("details") && this.setData({
        showBack: !1
      })
    }
  }
});